package sdc.com.petscalendar.fragments;

import java.text.SimpleDateFormat;
import java.util.Date;

import sdc.com.petscalendar.R;
import sdc.com.petscalendar.adapters.DayAdapter;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridView;
import android.widget.TextView;

public class CalendarDayFragment extends BaseFragment {
	public static final String MIME_TYPE = "vnd.android.cursor.dir/vnd.exina.android.calendar.date";
	private GridView mCalendar = null;
	private DayAdapter mDayAdapter;
	private int month;
	private TextView mTvMonth;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		if (mView == null) {
			mView = inflater.inflate(R.layout.fragment_calendar_day, container,
					false);
		}
		return mView;
	}

	@SuppressLint("SimpleDateFormat")
	@SuppressWarnings("deprecation")
	@Override
	public void onViewCreated(View view, Bundle savedInstanceState) {
		super.onViewCreated(view, savedInstanceState);
		mCalendar = (GridView) getView().findViewById(R.id.gr_calendar);
		mDayAdapter = new DayAdapter(getActivity(),month = getArguments().getInt(
				"month"));
		mTvMonth =(TextView)getView().findViewById(R.id.tv_month);
		Date d = new Date();
		d.setMonth(month);
		mTvMonth.setText(new SimpleDateFormat("MMMM").format(d));
		mCalendar.setAdapter(mDayAdapter);
	}

}
